#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long LL;
#define endl '\n'

const int N = 2e5 + 10;
struct node
{
    LL x, y;
}a[N], b[N];
int n; 
bool cmp1(node& a, node& b)
{
    return a.x < b.x;
}

bool cmp2(node& a, node& b)
{
    return a.y < b.y;
}

LL calc()
{
    LL ans = 4e18;
    LL r = 0, l = 2e9, d = 2e9, u = 0;
    for(int i = 2; i <= n; i++)
    {
        LL x = a[i].x, y = a[i].y;
        l = min(l, x); r = max(r, x);
        d = min(y, d); u = max(u, y);
    }
    LL ret = (abs(r - l) + 1) * (abs(u - d) + 1);
    if(ret == n - 1) ret += min(abs(r - l) + 1, abs(u - d) + 1);
    ans = min(ans, ret);
    r = 0, l = 2e9, d = 2e9, u = 0;
    for(int i = 1; i <= n - 1; i++)
    {
        LL x = a[i].x, y = a[i].y;
        l = min(l, x); r = max(r, x);
        d = min(y, d); u = max(u, y);
    }  
    ret = (abs(r - l) + 1) * (abs(u - d) + 1);
    if(ret == n - 1) ret += min(abs(r - l) + 1, abs(u - d) + 1);
    ans = min(ans, ret);
    r = 0, l = 2e9, d = 2e9, u = 0;
    for(int i = 1; i <= n - 1; i++)
    {
        LL x = b[i].x, y = b[i].y;
        l = min(l, x); r = max(r, x);
        d = min(y, d); u = max(u, y);
    }  
    ret = (abs(r - l) + 1) * (abs(u - d) + 1);
    if(ret == n - 1) ret += min(abs(r - l) + 1, abs(u - d) + 1);
    ans = min(ans, ret);
    r = 0, l = 2e9, d = 2e9, u = 0;
    for(int i = 2; i <= n; i++)
    {
        LL x = b[i].x, y = b[i].y;
        l = min(l, x); r = max(r, x);
        d = min(y, d); u = max(u, y);
    }  
    ret = (abs(r - l) + 1) * (abs(u - d) + 1);
    if(ret == n - 1) ret += min(abs(r - l) + 1, abs(u - d) + 1);
    ans = min(ans, ret);    
    return ans;
}

void solve() 
{
    cin >> n;;

    for(int i = 1; i <= n; i++) 
    {
        cin >> a[i].x >> a[i].y;
        b[i].x = a[i].x;
        b[i].y = a[i].y;
    }
    if(n == 1)
    {
        cout << 1 << endl;
        return;
    }
    sort(a + 1, a + 1 + n, cmp1);
    sort(b + 1, b + 1 + n, cmp2);
    cout << calc() << endl;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T;
	cin >> T;
	while(T--)
	{
        solve();
	}
	return 0;
}